﻿using AutoMapper;
using MediatR;
using S.Initial.API.Application.Command.BreedingMothers;
using S.Initial.Domain;
using S.Initial.Infrastructure.Interface;

namespace S.Initial.API.Application.CommandHandlers.BreedingMothers
{
    public class AuditBreeedingCommandHandler : IRequestHandler<AuditBreeedingCommand, int>
    {
        private readonly IBreedingMothersRepository breedingMothersRepository;
        private readonly IMapper mapper;

        public AuditBreeedingCommandHandler(IBreedingMothersRepository breedingMothersRepository, IMapper mapper)
        {
            this.breedingMothersRepository = breedingMothersRepository;
            this.mapper = mapper;
        }
        public Task<int> Handle(AuditBreeedingCommand request, CancellationToken cancellationToken)
        {
            return breedingMothersRepository.AddauditBy(mapper.Map<BreedMaleAndFemaleStart>(request));
        }
    }
}